﻿using System;
using UniRx;
using UniRx.Triggers;
using UnityEngine;
using UnityEngine.UI;

namespace Studio
{
	// Token: 0x020005DE RID: 1502
	[RequireComponent(typeof(GripRotation))]
	[RequireComponent(typeof(GripMove))]
	[RequireComponent(typeof(SteamVR_TrackedObject))]
	public class RightController : MonoBehaviour
	{
		// Token: 0x06002671 RID: 9841 RVA: 0x000E0F9C File Offset: 0x000DF19C
		private void ChangeMode()
		{
			int num = this.mode;
			if (num != 0)
			{
				if (num == 1)
				{
					this.gripMove.enabled = true;
					this.gripRotation.enabled = false;
					this.mode = 0;
					this.text.text = "移動";
				}
			}
			else
			{
				this.gripMove.enabled = false;
				this.gripRotation.enabled = true;
				this.mode = 1;
				this.text.text = "回転";
			}
		}

		// Token: 0x06002672 RID: 9842 RVA: 0x000E102C File Offset: 0x000DF22C
		private void Start()
		{
			SteamVR_Controller.Device device = SteamVR_Controller.Input((int)this.trackedObject.index);
			(from _ in this.UpdateAsObservable()
			where this.enabled
			where device.GetPressDown(2UL)
			select _).Subscribe(delegate(Unit _)
			{
				this.ChangeMode();
			});
		}

		// Token: 0x0400267B RID: 9851
		[SerializeField]
		private SteamVR_TrackedObject trackedObject;

		// Token: 0x0400267C RID: 9852
		[SerializeField]
		private GripMove gripMove;

		// Token: 0x0400267D RID: 9853
		[SerializeField]
		private GripRotation gripRotation;

		// Token: 0x0400267E RID: 9854
		[SerializeField]
		private Text text;

		// Token: 0x0400267F RID: 9855
		private int mode;
	}
}
